I've discovered .isEnabled for the buttons, so that's a step forward. I'm guessing now that they might perhaps be enabled within some textfield delegate method.
Post
Replies
Boosts
Views
Activity
Awesome! Thanks, Claude, that's been a great help.
Hi, Claude, I have a question about #selector. I see that it specifically wants an objc method, but I've been playing around and it seems to call methods such as "TextFieldShouldEndEditing", which are not bridged to @objc, without issue. I'm assuming that is probably not that case and it really shouldn't be done?
Thanks, Claude. Someone else introduced me to a way to acheive it by using notification center. Do you know if there are advantages to one over the other? I guess it all depends on the context.https://gist.github.com/TheCodedSelf/c4f3984dd9fcc015b3ab2f9f60f8ad51?fbclid=IwAR2d9rHhOxLcwemRvLMl-x4wfwwoywjqgHFJ3NQGb7aCqBzufpYCTlEWvy8
Thanks heaps, Eskimo. I'll take a look at it all and see if I can nut it out. I'm very much a novice, so I may have some more questions after I've tackled what you've given me.Cheers
I think I've got the logic of it now. Because I'm a bit slow, could you please correct me if I have this wrong.1. A key is derived from a password.2. It's used to encrypt the textfile.3. It can then be gotten rid of, because when it comes to decryption the same key will be derived from password input again and used to decrypt the file?
Thanks heaps. I have it running nicely in the playground. I spent quite a bit of time going down a few deadends trying to work out how to save it, until I cottoned on to saving it as Data. I hope you don't mind if I ask a few more questions.I've saved it this way:let filename = getDocumentsDirectory().appendingPathComponent("backup.txt")//Write to filedo { let e = Data(encryptedData.combined!) try e.write(to: filename)Is saving it to a standard .txt file okay?Also, for arguments sake, if the salt and rounds needed to be hidden, how would that be handled? I don't know anything about what happens when an app is installed, but I imagine the salt and rounds could be stored in a file and then, during installation, written to the keychain while the file is deleted, or would that be insecure? I guess that any values that required high security could be encrypted and then unencrypted during the installation process for passing into the keychain.Sorry for so many questions, but I have one more. I know that the iPhone is encrypted as a whole, but if I wanted to have encryption on top of that, within my app, is cryptokit suitable for implementing that, or would common crypto be the better option?
Cheers. It's a poor choice, but I have no idea what would be the right choice. If it was an image then it's jpeg, or png, or something obvious, but with lots of googling and time I still haven't tracked down what an encrypted data file ought to be.
Now to hunt down some info on how to do it.Thanks for all your help.
I've discovered that the code below is need in willConnectTo session, so that's one step forward :-)self.scene(scene, openURLContexts: connectionOptions.urlContexts)
I'm still struggling with this. I've read the UIScene documentation but still cannot see where I am going wrong. As I said, my file opens the app, it just doesn't call the openURLContexts function. As I understand it, iOS should automatically pass information about the file that opened the app to the ScenesDelegate, which would include the url to the file. Or do I have that wrong?
The line of code that I mentioned above, that I placed in the willConnectTo method only calls the openURLContexts method when the app is initially launched, not when it is launched from a saved file. Any help will be much appreciated.
Thank you. That one did slip by me. I’ve been doing a lot of experimenting in practice projects and the method is being called now without having to manually call it. I’m not sure what the initial problem was, but I suspect a setting in the info.plist. If the app is set to not run in the background the app Will start from an exported file, but openURL does not get called.
Hi eskimo, I've discovered my error. I set "open document in place" to NO, and it now imports and processes without a problem.
I was using the guard statement below, and when it wasn't working I tried the do statement, which didn't work either. I haven't tried the guard statement yet to see if it works since changing the setting, but I suspect that it will.
I don't know why it wasn't working. I guess it has something to do with the url having private in its path. I've got some learning to do there.
"Failed reading from URL: file:///private/var/mobile/Containers/Shared/AppGroup/FC9D99"
var data = Data()
do {
data = try Data(contentsOf: url)
}catch let error as NSError{
print("Failed reading from URL: \(url), Error: " + error.localizedDescription)
}
//guard let data = try? Data(contentsOf: url) else { return "blah" }
BTW, the error basically said that the app "doesn't have permission to view the file". Is there a way to grant it permission? Having the app open up by tapping on the file is a very nice feature.
Same here, as of an hour ago. I wish I hadn't updated.